package org.lex.jdbc.util;

import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.SQLException;

public class ConnectionUtils {
	public static String testConnection(Connection conn) throws SQLException {
		StringBuilder buf = new StringBuilder();
		DatabaseMetaData md = conn.getMetaData();
		buf.append("DBMS: ");
		buf.append(md.getDatabaseProductName()).append(" - ").append(md.getDatabaseProductVersion());
		buf.append("\n").append("Driver: ");
		buf.append(md.getDriverName()).append(" - ").append(md.getDriverVersion());
		return buf.toString();
	}
}
